package com.shuoyue.ycgk.ui.questionbank.search;

import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;

import com.chad.library.adapter.base.BaseViewHolder;
import com.shuoyue.ycgk.R;
import com.shuoyue.ycgk.base.baseadapter.AppBaseQuickAdapter;
import com.shuoyue.ycgk.entity.Option;
import com.shuoyue.ycgk.utils.MyRichTextHelper;
import com.zzhoujay.richtext.ImageHolder;
import com.zzhoujay.richtext.RichText;

import java.util.List;

public class SearchoptionAdapter extends AppBaseQuickAdapter<Option> {
    public SearchoptionAdapter(@Nullable List<Option> data) {
        super(R.layout.item_search_option, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, Option item) {
        helper.setText(R.id.mopion, item.isRight()
                ? "√" : item.getNo());
        MyRichTextHelper.showRich(mContext, item.getContent(), helper.getView(R.id.value));
        helper.setTextColor(R.id.mopion, item.isRight()
                ? ContextCompat.getColor(mContext, R.color.white)
                : ContextCompat.getColor(mContext, R.color.black));

        helper.setBackgroundRes(R.id.mopion, item.isRight() ? R.drawable.option_circle_y : R.drawable.option_circle_n);
    }
}
